package no.ntnu.fp.messages.impl;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
import no.ntnu.fp.utils.XmlParser;
import no.ntnu.fp.messages.Message;
import no.ntnu.fp.messages.MessageCode;

public class LoginFailedMessage implements Message {

	@Override
	public MessageCode getMessageCode() {
		return MessageCode.LOGIN_FAILED_MESSAGE;
	}

	@Override
	public Message fromXmlString(String xml) {
		return new LoginFailedMessage();
	}

	@Override
	public String toString() {
		Document dom = XmlParser.getThreadLocalDocumentBuilder().newDocument();
		Element rootElement = dom.createElement("message");
		return this.getMessageCode().toString() + "" + XmlParser.convertXmlToString(rootElement);
	}

}
